package org.jiucai.cas.auth.service;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jiucai.cas.domain.UserInfo;

/**
 * 认证处理接口
 * @author zhaidw
 *
 */
public interface AuthResultService {

	/**
	 * 登录成功时的处理方法
	 * @param user 登录的用户信息
	 * @param request 请求
	 * @param response 响应
	 * @throws ServletException
	 * @throws IOException
	 */
	public void onLoginSuccess(UserInfo user,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException;
	
	/**
	 * 登录失败时的处理方法，错误消息放在 request.setAttribute("failed_msg", "error msg"); 中
	 * @param request 请求
	 * @param response 响应
	 * @throws ServletException
	 * @throws IOException
	 */
	public void onLoginFailed(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException;

	/**
	 * 注销成功时的处理方法
	 * @param request
	 * @param response
	 * @throws ServletException
	 * @throws IOException
	 */
	public void onLogoutSuccess(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException;

	/**
	 * 注销失败时的处理方法
	 * @param request
	 * @param response
	 * @throws ServletException
	 * @throws IOException
	 */
	public void onLogoutFailed(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException;
}
